<?php

/**
 * Application filter form base class.
 *
 * @package    wills
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseApplicationFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'email'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'password'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'area_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('area'), 'add_empty' => true)),
      'name'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'name_en'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'age'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'minzu'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'height'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'weight'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'bwh'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'occupation'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'education'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'college'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'address'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'id_card'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'phone'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'qq'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'website'       => new sfWidgetFormFilterInput(),
      'native_place'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'contact'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'relation'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'contact_phone' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'introduction'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'hobby'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'watchword'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'picture'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'picturelife'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'is_passed'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'created_at'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'    => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'email'         => new sfValidatorPass(array('required' => false)),
      'password'      => new sfValidatorPass(array('required' => false)),
      'area_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('area'), 'column' => 'id')),
      'name'          => new sfValidatorPass(array('required' => false)),
      'name_en'       => new sfValidatorPass(array('required' => false)),
      'age'           => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'minzu'         => new sfValidatorPass(array('required' => false)),
      'height'        => new sfValidatorPass(array('required' => false)),
      'weight'        => new sfValidatorPass(array('required' => false)),
      'bwh'           => new sfValidatorPass(array('required' => false)),
      'occupation'    => new sfValidatorPass(array('required' => false)),
      'education'     => new sfValidatorPass(array('required' => false)),
      'college'       => new sfValidatorPass(array('required' => false)),
      'address'       => new sfValidatorPass(array('required' => false)),
      'id_card'       => new sfValidatorPass(array('required' => false)),
      'phone'         => new sfValidatorPass(array('required' => false)),
      'qq'            => new sfValidatorPass(array('required' => false)),
      'website'       => new sfValidatorPass(array('required' => false)),
      'native_place'  => new sfValidatorPass(array('required' => false)),
      'contact'       => new sfValidatorPass(array('required' => false)),
      'relation'      => new sfValidatorPass(array('required' => false)),
      'contact_phone' => new sfValidatorPass(array('required' => false)),
      'introduction'  => new sfValidatorPass(array('required' => false)),
      'hobby'         => new sfValidatorPass(array('required' => false)),
      'watchword'     => new sfValidatorPass(array('required' => false)),
      'picture'       => new sfValidatorPass(array('required' => false)),
      'picturelife'   => new sfValidatorPass(array('required' => false)),
      'is_passed'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'created_at'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'    => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('application_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Application';
  }

  public function getFields()
  {
    return array(
      'id'            => 'Number',
      'email'         => 'Text',
      'password'      => 'Text',
      'area_id'       => 'ForeignKey',
      'name'          => 'Text',
      'name_en'       => 'Text',
      'age'           => 'Number',
      'minzu'         => 'Text',
      'height'        => 'Text',
      'weight'        => 'Text',
      'bwh'           => 'Text',
      'occupation'    => 'Text',
      'education'     => 'Text',
      'college'       => 'Text',
      'address'       => 'Text',
      'id_card'       => 'Text',
      'phone'         => 'Text',
      'qq'            => 'Text',
      'website'       => 'Text',
      'native_place'  => 'Text',
      'contact'       => 'Text',
      'relation'      => 'Text',
      'contact_phone' => 'Text',
      'introduction'  => 'Text',
      'hobby'         => 'Text',
      'watchword'     => 'Text',
      'picture'       => 'Text',
      'picturelife'   => 'Text',
      'is_passed'     => 'Boolean',
      'created_at'    => 'Date',
      'updated_at'    => 'Date',
    );
  }
}
